//
//  PopMenu.swift
//  微博项目
//
//  Created by admin on 16/3/3.
//  Copyright © 2016年 jin. All rights reserved.
//

import UIKit

class PopMenu: UIImageView {

    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */
    class func show(frame:CGRect)->PopMenu
    {
        let menu = PopMenu(frame: frame)
        menu.userInteractionEnabled = true
        menu.image = UIImage(imageLiteral: "popover_background").stretchableImageWithLeftCapWidth(20, topCapHeight: 20)
        UIApplication.sharedApplication().keyWindow?.addSubview(menu)
        UIApplication.sharedApplication().keyWindow?.bringSubviewToFront(menu)
        return menu
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        for view in self.subviews
        {
            if(view is UITableView)
            {
                let x:CGFloat = 5
                let y:CGFloat = 10
                view.frame = CGRectMake(x, y, self.bounds.size.width - (x * 2), self.bounds.size.height - (y * 2))
            }
        }
    }

}
